package 数组;

public class test$ {
    public static void main(String[] args) {
        start();
    }
    public static void start(){
    //1,做牌:创建一个动态化数组存储54张牌
        String pokers[] = new String[54];
        //2,准别四种花色，还有点数，放入数组
        String colors[] = {"♠","♥","♣","♦"};
        String numbers[] = {"2","A","K","Q","J","10","9","8","7","6","5","4","3"};

        //3,先遍历点数，在遍历花色
        int index = 0;
        for(int i = 0; i < numbers.length; i++)
        {
            for(int j = 0; j < colors.length; j++)
            {
                pokers[index] = colors[j]+numbers[i];
                index++;
            }
        }
        //4,给数组中添加大小王
        pokers[index++] = "小王";
        pokers[index] = "大王";

        //5打印牌
        System.out.println("新牌：");
        int i = 0;
        for(i = 0;i<pokers.length;i++)
        {
            System.out.print(pokers[i]+" ");
        }

        //6，洗牌
        for(i = 0;i<pokers.length;i++)
            for(int j = 0;j<pokers.length;j++)
            {
                int index1 = (int)(Math.random()*pokers.length);
                int index2 = (int)(Math.random()*pokers.length);
                String temp = pokers[index1];
                pokers[index1] = pokers[index2];
                pokers[index2] = temp;
            }

        System.out.println("洗牌后：");
        for(i = 0;i<pokers.length;i++)
        {
            System.out.print(pokers[i]+" ");
        }

    }

}
